package cn.edu.suda.ada.database.connection.pool;

import cn.edu.suda.ada.common.config.Config;
import cn.edu.suda.ada.database.exception.DatabaseException;

public abstract class DefaultConnectionPool implements ConnectionPool {
	public static ConnectionPool getConnectionPool(Class<? extends ConnectionPool> c, Config config) throws DatabaseException {
		ConnectionPool pool;
		try {
			pool = c.newInstance();
		} catch (Exception e) {
			throw new DatabaseException("无法实例化数据库连接池类：" + c.getName(), e);
		}
		pool.init(config);
		return pool;
	}
}
